package com.aitesting.component;


import com.aitesting.domain.ApiRequestData;
import com.aitesting.form.RequestForm;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper
public interface RequestFormConverter {

    //自动创建一个RequestFormConverter接口的实现实例
    RequestFormConverter INSTANCE = Mappers.getMapper(RequestFormConverter.class);

    @Mappings({
            @Mapping(source = "path", target = "url"),
            @Mapping(source = "parameters", target = "params"),
            @Mapping(target = "timeout", ignore = true)
    })
    ApiRequestData requestFormToApiRequestData(RequestForm requestForm);
}
